<?php
$grade_options = array(
    '' => 'None',
    '-1' => 'Pre-K', '0' => 'K',
    '1' => 'Grade-1', '2' => 'Grade-2',
    '3' => 'Grade-3', '4' => 'Grade-4',
    '5' => 'Grade-5', '6' => 'Grade-6',
    '7' => 'Grade-7', '8' => 'Grade-8',
    '9' => 'Fresh man',
    '10' => 'Sophmore', '11' => 'Junior',
    '12' => 'Senior', '13' => 'Other'
);
?>
<div id="blocks-wrapper">
<table id="blocks" class="sticky-enabled tablesorter">
    <thead>
        <tr>
            <th class="region"><?php print t('Last Name'); ?></th>
            <th class="region"><?php print t('First Name'); ?></th>
            <th class="region"><?php print t('Grade'); ?></th>
            <th class="region"><?php print t('Email'); ?></th>
            <th class="region"><?php print t('Join Date'); ?></th>
            <th class="region"><?php print t('# of contacts'); ?></th>
            <th class="region"><?php print t('Operations'); ?></th>
        </tr>
    </thead>
    <tbody>
        <?php if ($user_list != NULL) { ?>
            <?php foreach ($user_list as $index => $u): // $user_list is the array of users.?>
                <tr>
 
                    <td><?php print t($u->field_lastname_value); ?></td>
                    <td><?php print t($u->field_firstname_value); ?></td>
                    <td><?php print t($grade_options[$u->field_student_grade_value]); ?></td>
                    <td><?php print t($u->mail); ?></td>
                    <td><?php print t(date('Y-m-d H:i:s', $u->join_date)); ?></td>
                    <td><?php print t($u->contacts); ?></td>
                    <td><?php print l("edit", "user/" . $u->uid); ?></td>
                </tr>
            <?php endforeach; ?> 
        <?php }else { ?>
            <tr>
                <td style="color:blue;">No Results Found.</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
        <!--        <td>&nbsp;</td>  -->
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
        <?php } ?>
    </tbody>

    <tfoot>
        <tr>
            <td style="color:blue;"><?php print $pre_link; ?></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        <!--    <td>&nbsp;</td>  -->
            <td style="color:blue;"><?php print $next_link; ?></td>
        </tr>
    </tfoot>
</table>
</div>